package com.gatewat.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;


//@Configuration
public class GatewayRoutes {
 
    @Bean
    @Order(-200)
    public RouteLocator routeLocator(RouteLocatorBuilder builder) {
        return builder.routes()
                .route(r ->
                        r.path("/api/question/**")
                                .filters(
                                        f -> f.stripPrefix(1)
                                )
                                .uri("lb://question")
                )
                .build();
    }
 
}